import { ref, computed } from 'vue'
export default function () {
  let firstName = ref('games')
  let lastName = ref('CJ')
  let changeLastName = () => {
    lastName.value = 'kobe'
  }
  /* 1 默认 */
  // let allName = computed(() => {
  //   return firstName.value + lastName.value
  // })
  /* 2 get/set */
  let allName = computed({
    get() {
      console.log('computed--allName--get') //变化设置值
      return firstName.value + `.` + lastName.value
    },
    set(val) {
      console.log('computed--allName', val) //变化设置值
    },
  })
  return { allName, firstName, lastName, changeLastName }
}
